package com.lengxf.pay.ali.service;

import com.alipay.api.domain.AlipayTradePagePayModel;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.lengxf.pay.ali.config.ALI_PayConfig;
import com.lengxf.pay.common.bean.PayOrder;

public record AliWebPayService(ALI_PayConfig aliPayConfig) {


    public AlipayTradePagePayRequest toPay(PayOrder payOrder) {
        AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
        AlipayTradePagePayModel model = new AlipayTradePagePayModel();
        model.setOutTradeNo(payOrder.getOrderNo());
        model.setTotalAmount(String.valueOf(payOrder.getPrice()));
        model.setSubject(payOrder.getProductDesc());
        model.setProductCode("FAST_INSTANT_TRADE_PAY");
        request.setBizModel(model);
        return request;
    }

}
